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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.w: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: G = None
        self.w: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.s: B = None
        self.p: B = None
        self.y: H = None
        self.w: A = None
        self.u: F = None
        self.txt = txt

f = A("f")
k = B("k")
a = C("a")
l = D("l")
d = E("d")
m = F("m")
c = G("c")
j = H("j")
n = G("n")
g = H("g")

f.p = a
f.u = l
k.p = g
k.q = l
a.x = f
a.o = f
l.o = a
l.s = m
l.w = m
d.y = k
m.o = f
m.p = n
m.w = j
c.o = k
c.q = f
c.p = l
j.t = c
j.s = k
j.p = k
j.y = g
j.w = f
j.u = m
n.o = k
n.q = f
n.p = l
g.t = c
g.s = k
g.p = k
g.y = j
g.w = f
g.u = m
assert l.o.x.u.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.w: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: G = None
        self.w: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.s: B = None
        self.p: B = None
        self.y: H = None
        self.w: A = None
        self.u: F = None
        self.txt = txt

f = A("f")
k = B("k")
a = C("a")
l = D("l")
d = E("d")
m = F("m")
c = G("c")
j = H("j")
n = G("n")
g = H("g")

f.p = a
f.u = l
k.p = g
k.q = l
a.x = f
a.o = f
l.o = a
l.s = m
l.w = m
d.y = k
m.o = f
m.p = n
m.w = j
c.o = k
c.q = f
c.p = l
j.t = c
j.s = k
j.p = k
j.y = g
j.w = f
j.u = m
n.o = k
n.q = f
n.p = l
g.t = c
g.s = k
g.p = k
g.y = j
g.w = f
g.u = m
assert l.o.x.u.o.x.txt == "f"