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

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

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

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

f = A("f")
b = B("b")
a = C("a")
m = D("m")
k = D("k")
d = D("d")
i = A("i")
l = D("l")
c = B("c")
h = C("h")

f.t = h
f.x = i
b.o = c
b.s = a
a.r = h
a.y = f
m.q = i
m.z = h
k.q = i
k.z = a
d.q = i
d.z = h
i.t = h
i.x = f
l.q = i
l.z = h
c.o = b
c.s = a
h.r = a
h.y = i
assert b.s.r.y.x.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: A = None
        self.txt = txt

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

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

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

f = A("f")
b = B("b")
a = C("a")
m = D("m")
k = D("k")
d = D("d")
i = A("i")
l = D("l")
c = B("c")
h = C("h")

f.t = h
f.x = i
b.o = c
b.s = a
a.r = h
a.y = f
m.q = i
m.z = h
k.q = i
k.z = a
d.q = i
d.z = h
i.t = h
i.x = f
l.q = i
l.z = h
c.o = b
c.s = a
h.r = a
h.y = i
assert b.s.r.y.x.t.r.txt == "a"