class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: F = None
        self.w: E = None
        self.z: A = None
        self.r: D = None
        self.v: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: D = None
        self.r: D = None
        self.o: B = None
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

g.q = j
g.w = j
j.s = e
j.q = b
j.v = b
j.w = c
j.z = g
j.r = l
e.o = f
l.x = g
c.y = e
c.z = l
c.r = l
c.o = j
c.x = f
b.w = f
f.p = g
f.v = g
k.y = e
k.z = l
k.r = l
k.o = j
k.x = f
assert k.o.w.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: F = None
        self.w: E = None
        self.z: A = None
        self.r: D = None
        self.v: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: D = None
        self.r: D = None
        self.o: B = None
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

g.q = j
g.w = j
j.s = e
j.q = b
j.v = b
j.w = c
j.z = g
j.r = l
e.o = f
l.x = g
c.y = e
c.z = l
c.r = l
c.o = j
c.x = f
b.w = f
f.p = g
f.v = g
k.y = e
k.z = l
k.r = l
k.o = j
k.x = f
assert k.o.w.o.z.txt == "g"