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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: F = None
        self.txt = txt

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

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

i.y = a
c.q = e
c.r = e
d.w = i
d.s = a
d.u = c
d.r = m
e.r = a
e.v = i
m.w = d
m.p = a
a.t = m
a.v = e
assert a.t.w.s.t.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: F = None
        self.txt = txt

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

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

i.y = a
c.q = e
c.r = e
d.w = i
d.s = a
d.u = c
d.r = m
e.r = a
e.v = i
m.w = d
m.p = a
a.t = m
a.v = e
assert a.t.w.s.t.p.v.txt == "e"