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

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

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

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

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

b.p = c
b.u = l
b.v = l
g.s = l
g.w = j
g.t = j
g.v = c
j.r = e
j.p = e
l.t = c
e.r = j
e.p = j
c.p = b
c.u = l
c.v = l
assert l.t.u.t.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

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

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

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

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

b.p = c
b.u = l
b.v = l
g.s = l
g.w = j
g.t = j
g.v = c
j.r = e
j.p = e
l.t = c
e.r = j
e.p = j
c.p = b
c.u = l
c.v = l
assert l.t.u.t.p.u.txt == "l"