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

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

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

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

l = A("l")
k = B("k")
b = C("b")
f = D("f")
h = C("h")
e = D("e")
a = A("a")
g = B("g")
c = A("c")

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

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

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

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

l = A("l")
k = B("k")
b = C("b")
f = D("f")
h = C("h")
e = D("e")
a = A("a")
g = B("g")
c = A("c")

l.t = b
l.v = e
l.p = f
k.t = c
k.r = f
b.o = h
b.u = g
f.t = h
f.p = g
f.w = c
h.o = b
h.u = g
e.t = b
e.p = g
e.w = c
a.t = h
a.v = e
a.p = f
g.t = a
g.r = f
c.t = b
c.v = f
c.p = e
assert b.u.r.p.t.v.w.p.t.txt == "b"