class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

l = A("l")
d = B("d")
i = C("i")
e = D("e")
j = E("j")
c = F("c")
a = D("a")

l.t = i
l.y = e
d.o = c
i.y = a
i.q = c
e.y = d
j.x = l
j.z = c
j.y = i
j.p = i
c.y = i
c.p = i
c.q = a
a.y = d
assert d.o.p.q.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

l = A("l")
d = B("d")
i = C("i")
e = D("e")
j = E("j")
c = F("c")
a = D("a")

l.t = i
l.y = e
d.o = c
i.y = a
i.q = c
e.y = d
j.x = l
j.z = c
j.y = i
j.p = i
c.y = i
c.p = i
c.q = a
a.y = d
assert d.o.p.q.y.y.y.txt == "d"