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

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: C = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
c = C("c")
i = D("i")
e = B("e")
a = D("a")

f.y = a
f.r = a
f.s = c
f.t = c
h.x = e
h.t = c
c.v = h
i.y = h
i.p = e
i.s = c
i.z = a
e.x = h
e.t = c
a.y = h
a.p = h
a.s = c
a.z = i
assert e.t.v.t.v.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: D = None
        self.s: C = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: C = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
c = C("c")
i = D("i")
e = B("e")
a = D("a")

f.y = a
f.r = a
f.s = c
f.t = c
h.x = e
h.t = c
c.v = h
i.y = h
i.p = e
i.s = c
i.z = a
e.x = h
e.t = c
a.y = h
a.p = h
a.s = c
a.z = i
assert e.t.v.t.v.x.t.txt == "c"