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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

f.p = h
f.v = b
f.z = l
f.u = k
h.r = d
l.t = e
l.q = e
l.u = n
b.x = c
e.u = f
k.p = h
k.v = b
k.z = n
k.u = f
d.r = h
n.t = e
n.q = g
n.u = l
g.u = f
c.x = b
assert e.u.u.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: D = None
        self.z: C = None
        self.u: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

f.p = h
f.v = b
f.z = l
f.u = k
h.r = d
l.t = e
l.q = e
l.u = n
b.x = c
e.u = f
k.p = h
k.v = b
k.z = n
k.u = f
d.r = h
n.t = e
n.q = g
n.u = l
g.u = f
c.x = b
assert e.u.u.p.r.txt == "d"