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

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

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

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

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

f.o = k
f.p = k
e.x = b
e.t = b
e.q = c
e.y = f
l.q = e
l.t = a
k.q = f
k.x = e
d.q = e
d.t = f
i.q = c
i.t = f
c.x = b
c.q = e
c.t = e
c.y = f
a.o = k
a.p = k
b.x = c
b.q = c
b.y = a
b.t = e
assert f.p.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

f.o = k
f.p = k
e.x = b
e.t = b
e.q = c
e.y = f
l.q = e
l.t = a
k.q = f
k.x = e
d.q = e
d.t = f
i.q = c
i.t = f
c.x = b
c.q = e
c.t = e
c.y = f
a.o = k
a.p = k
b.x = c
b.q = c
b.y = a
b.t = e
assert f.p.x.t.txt == "b"