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

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

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

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

a = A("a")
e = B("e")
l = C("l")
g = D("g")
b = C("b")

a.u = b
a.r = b
a.t = b
e.t = l
e.w = b
e.p = g
e.x = g
l.o = b
l.u = b
l.p = g
g.p = a
b.o = l
b.u = l
b.p = g
assert e.t.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: C = None
        self.t: C = None
        self.txt = txt

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

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

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

a = A("a")
e = B("e")
l = C("l")
g = D("g")
b = C("b")

a.u = b
a.r = b
a.t = b
e.t = l
e.w = b
e.p = g
e.x = g
l.o = b
l.u = b
l.p = g
g.p = a
b.o = l
b.u = l
b.p = g
assert e.t.p.p.txt == "a"