class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: B = None
        self.p: F = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

e.v = l
e.p = l
e.t = l
e.u = l
e.x = d
d.t = c
d.u = l
i.r = d
i.v = d
c.v = l
h.z = c
h.q = i
h.y = i
l.t = d
l.q = c
assert d.t.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: B = None
        self.p: F = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

e.v = l
e.p = l
e.t = l
e.u = l
e.x = d
d.t = c
d.u = l
i.r = d
i.v = d
c.v = l
h.z = c
h.q = i
h.y = i
l.t = d
l.q = c
assert d.t.v.q.v.txt == "l"