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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: D = None
        self.o: F = None
        self.t: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

n = A("n")
h = B("h")
m = C("m")
j = D("j")
l = E("l")
c = F("c")
b = B("b")
d = E("d")
i = E("i")
g = B("g")

n.p = l
n.q = m
h.q = b
h.y = i
h.r = m
m.x = j
m.w = c
m.u = h
j.w = c
j.q = c
l.z = i
l.y = j
l.o = c
l.t = d
c.t = m
b.q = h
b.y = i
b.r = m
d.z = i
d.y = j
d.o = c
d.t = l
i.z = d
i.y = j
i.o = c
i.t = l
g.q = b
g.y = d
g.r = m
assert g.q.q.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: D = None
        self.o: F = None
        self.t: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

n = A("n")
h = B("h")
m = C("m")
j = D("j")
l = E("l")
c = F("c")
b = B("b")
d = E("d")
i = E("i")
g = B("g")

n.p = l
n.q = m
h.q = b
h.y = i
h.r = m
m.x = j
m.w = c
m.u = h
j.w = c
j.q = c
l.z = i
l.y = j
l.o = c
l.t = d
c.t = m
b.q = h
b.y = i
b.r = m
d.z = i
d.y = j
d.o = c
d.t = l
i.z = d
i.y = j
i.o = c
i.t = l
g.q = b
g.y = d
g.r = m
assert g.q.q.r.u.txt == "h"