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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: E = None
        self.u: B = None
        self.x: E = None
        self.z: D = None
        self.v: C = None
        self.txt = txt

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

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

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

l = A("l")
e = B("e")
g = C("g")
a = D("a")
h = E("h")
d = F("d")
f = C("f")
j = A("j")
k = A("k")

l.p = j
l.q = h
e.s = h
g.t = a
g.z = a
g.p = h
g.x = h
g.u = e
g.v = f
a.p = h
h.u = d
h.x = a
d.w = j
f.t = a
f.z = a
f.p = h
f.x = h
f.u = e
f.v = g
j.p = k
j.q = h
k.p = l
k.q = h
assert l.q.x.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: E = None
        self.u: B = None
        self.x: E = None
        self.z: D = None
        self.v: C = None
        self.txt = txt

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

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

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

l = A("l")
e = B("e")
g = C("g")
a = D("a")
h = E("h")
d = F("d")
f = C("f")
j = A("j")
k = A("k")

l.p = j
l.q = h
e.s = h
g.t = a
g.z = a
g.p = h
g.x = h
g.u = e
g.v = f
a.p = h
h.u = d
h.x = a
d.w = j
f.t = a
f.z = a
f.p = h
f.x = h
f.u = e
f.v = g
j.p = k
j.q = h
k.p = l
k.q = h
assert l.q.x.p.u.txt == "d"