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

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: C = None
        self.p: G = None
        self.y: E = None
        self.t: C = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: A = None
        self.w: G = None
        self.y: H = None
        self.r: H = None
        self.txt = txt

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

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

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

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

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

m = A("m")
b = B("b")
d = C("d")
j = D("j")
e = E("e")
a = F("a")
l = G("l")
g = H("g")

m.p = e
m.r = e
m.o = a
m.u = b
b.x = l
b.p = l
b.u = d
b.t = d
b.y = e
b.r = m
d.p = e
d.s = m
d.w = l
d.y = g
d.r = g
j.p = b
e.p = d
a.p = b
a.s = l
a.t = e
a.r = m
a.z = j
a.o = d
a.u = d
l.p = e
l.o = d
g.z = m
assert b.u.p.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: F = None
        self.r: E = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: C = None
        self.p: G = None
        self.y: E = None
        self.t: C = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: A = None
        self.w: G = None
        self.y: H = None
        self.r: H = None
        self.txt = txt

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

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

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

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

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

m = A("m")
b = B("b")
d = C("d")
j = D("j")
e = E("e")
a = F("a")
l = G("l")
g = H("g")

m.p = e
m.r = e
m.o = a
m.u = b
b.x = l
b.p = l
b.u = d
b.t = d
b.y = e
b.r = m
d.p = e
d.s = m
d.w = l
d.y = g
d.r = g
j.p = b
e.p = d
a.p = b
a.s = l
a.t = e
a.r = m
a.z = j
a.o = d
a.u = d
l.p = e
l.o = d
g.z = m
assert b.u.p.p.r.txt == "g"