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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: F = None
        self.w: A = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.q: A = None
        self.y: A = None
        self.txt = txt

l = A("l")
c = B("c")
j = C("j")
g = D("g")
d = E("d")
b = F("b")

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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: F = None
        self.w: A = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.q: A = None
        self.y: A = None
        self.txt = txt

l = A("l")
c = B("c")
j = C("j")
g = D("g")
d = E("d")
b = F("b")

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