class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: B = None
        self.u: D = None
        self.r: F = None
        self.t: D = None
        self.txt = txt

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

n = A("n")
h = B("h")
b = C("b")
d = D("d")
i = E("i")
e = F("e")
g = D("g")
l = F("l")
a = D("a")
c = B("c")

n.u = c
n.x = e
h.u = i
b.o = i
b.r = i
b.p = h
d.o = l
d.p = e
d.x = e
d.y = b
i.z = c
i.o = h
i.u = g
i.r = l
i.t = a
e.r = i
g.o = e
g.p = e
g.x = l
g.y = b
l.r = i
a.o = l
a.p = l
a.x = l
a.y = b
c.u = i
assert b.o.u.x.r.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: B = None
        self.u: D = None
        self.r: F = None
        self.t: D = None
        self.txt = txt

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

n = A("n")
h = B("h")
b = C("b")
d = D("d")
i = E("i")
e = F("e")
g = D("g")
l = F("l")
a = D("a")
c = B("c")

n.u = c
n.x = e
h.u = i
b.o = i
b.r = i
b.p = h
d.o = l
d.p = e
d.x = e
d.y = b
i.z = c
i.o = h
i.u = g
i.r = l
i.t = a
e.r = i
g.o = e
g.p = e
g.x = l
g.y = b
l.r = i
a.o = l
a.p = l
a.x = l
a.y = b
c.u = i
assert b.o.u.x.r.o.u.txt == "i"