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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: E = None
        self.p: B = None
        self.t: F = None
        self.q: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.t: F = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: E = None
        self.p: B = None
        self.t: F = None
        self.q: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.t: F = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: B = None
        self.txt = txt

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

h.u = n
h.t = n
l.r = d
l.y = b
l.p = f
l.t = k
l.q = n
m.z = b
n.r = h
n.v = h
n.t = k
n.x = g
b.w = m
b.r = n
b.o = l
g.p = b
g.v = l
f.r = d
f.y = b
f.p = l
f.t = k
f.q = n
k.p = b
k.v = f
d.u = n
d.t = n
assert l.p.p.r.u.x.v.r.u.x.txt == "g"