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.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = 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.x: D = None
        self.q: D = None
        self.y: F = None
        self.p: F = None
        self.z: D = None
        self.u: B = None
        self.txt = txt

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

g = A("g")
k = B("k")
m = C("m")
l = D("l")
e = E("e")
j = F("j")
h = C("h")
n = B("n")

g.p = h
g.u = l
k.q = e
m.q = k
l.p = e
e.x = l
e.q = l
e.z = l
e.y = j
e.p = j
e.u = n
j.v = g
j.r = l
j.z = e
h.q = n
n.q = e
assert h.q.q.z.p.u.q.u.q.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.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = 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.x: D = None
        self.q: D = None
        self.y: F = None
        self.p: F = None
        self.z: D = None
        self.u: B = None
        self.txt = txt

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

g = A("g")
k = B("k")
m = C("m")
l = D("l")
e = E("e")
j = F("j")
h = C("h")
n = B("n")

g.p = h
g.u = l
k.q = e
m.q = k
l.p = e
e.x = l
e.q = l
e.z = l
e.y = j
e.p = j
e.u = n
j.v = g
j.r = l
j.z = e
h.q = n
n.q = e
assert h.q.q.z.p.u.q.u.q.txt == "e"