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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: C = None
        self.o: D = None
        self.s: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: B = None
        self.u: D = None
        self.y: A = None
        self.s: A = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: B = None
        self.w: B = None
        self.q: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

b = A("b")
d = B("d")
j = C("j")
g = D("g")
m = E("m")
e = F("e")
n = B("n")

b.r = e
b.v = j
d.y = g
d.o = g
d.z = j
d.s = e
j.x = g
j.u = g
j.t = n
j.y = b
j.s = b
j.w = b
g.o = j
g.x = n
g.w = n
g.q = e
m.t = b
e.u = g
n.y = g
n.o = g
n.z = j
n.s = e
assert g.w.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: C = None
        self.o: D = None
        self.s: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: B = None
        self.u: D = None
        self.y: A = None
        self.s: A = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: B = None
        self.w: B = None
        self.q: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

b = A("b")
d = B("d")
j = C("j")
g = D("g")
m = E("m")
e = F("e")
n = B("n")

b.r = e
b.v = j
d.y = g
d.o = g
d.z = j
d.s = e
j.x = g
j.u = g
j.t = n
j.y = b
j.s = b
j.w = b
g.o = j
g.x = n
g.w = n
g.q = e
m.t = b
e.u = g
n.y = g
n.o = g
n.z = j
n.s = e
assert g.w.z.t.z.txt == "j"