class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: G = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: A = None
        self.r: C = None
        self.s: C = None
        self.v: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: A = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

j = A("j")
h = B("h")
k = C("k")
g = D("g")
b = E("b")
e = F("e")
l = G("l")

j.z = l
h.p = l
h.o = g
k.v = e
g.x = e
g.u = e
g.v = l
b.z = l
b.o = j
b.v = j
b.r = k
b.s = k
e.w = b
e.u = b
e.s = j
l.o = b
assert h.o.u.u.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: G = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: A = None
        self.r: C = None
        self.s: C = None
        self.v: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: A = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

j = A("j")
h = B("h")
k = C("k")
g = D("g")
b = E("b")
e = F("e")
l = G("l")

j.z = l
h.p = l
h.o = g
k.v = e
g.x = e
g.u = e
g.v = l
b.z = l
b.o = j
b.v = j
b.r = k
b.s = k
e.w = b
e.u = b
e.s = j
l.o = b
assert h.o.u.u.o.z.o.txt == "b"