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

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

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

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

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

l.z = b
l.r = e
h.p = f
m.r = h
m.u = f
m.x = k
m.o = c
f.y = b
e.z = b
e.r = l
b.y = f
c.p = f
k.r = c
k.u = b
k.x = n
k.o = h
n.r = h
n.o = h
n.u = f
n.x = m
g.r = h
g.u = b
g.x = k
g.o = c
assert e.r.r.z.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: A = None
        self.txt = txt

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

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

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

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

l.z = b
l.r = e
h.p = f
m.r = h
m.u = f
m.x = k
m.o = c
f.y = b
e.z = b
e.r = l
b.y = f
c.p = f
k.r = c
k.u = b
k.x = n
k.o = h
n.r = h
n.o = h
n.u = f
n.x = m
g.r = h
g.u = b
g.x = k
g.o = c
assert e.r.r.z.y.y.y.txt == "f"