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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: D = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

b = A("b")
g = B("g")
j = C("j")
i = D("i")
a = B("a")
f = C("f")
l = D("l")

b.o = i
b.s = f
g.y = j
g.o = j
j.o = b
j.y = i
j.t = f
i.x = j
i.z = j
i.p = l
i.u = l
a.y = f
a.o = f
f.o = b
f.y = l
f.t = j
l.x = f
l.p = i
l.u = i
l.z = j
assert i.z.t.y.x.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: D = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

b = A("b")
g = B("g")
j = C("j")
i = D("i")
a = B("a")
f = C("f")
l = D("l")

b.o = i
b.s = f
g.y = j
g.o = j
j.o = b
j.y = i
j.t = f
i.x = j
i.z = j
i.p = l
i.u = l
a.y = f
a.o = f
f.o = b
f.y = l
f.t = j
l.x = f
l.p = i
l.u = i
l.z = j
assert i.z.t.y.x.o.s.txt == "f"