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

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

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

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

i = A("i")
f = B("f")
l = C("l")
k = D("k")
e = D("e")
g = D("g")

i.t = k
i.u = e
f.r = g
f.t = e
f.s = i
l.y = i
l.r = i
l.o = i
l.t = f
k.t = l
k.r = l
k.y = i
e.t = l
e.r = l
e.y = i
g.t = l
g.r = l
g.y = i
assert f.s.t.y.u.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: D = None
        self.txt = txt

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

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

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

i = A("i")
f = B("f")
l = C("l")
k = D("k")
e = D("e")
g = D("g")

i.t = k
i.u = e
f.r = g
f.t = e
f.s = i
l.y = i
l.r = i
l.o = i
l.t = f
k.t = l
k.r = l
k.y = i
e.t = l
e.r = l
e.y = i
g.t = l
g.r = l
g.y = i
assert f.s.t.y.u.t.t.txt == "f"