class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: E = None
        self.o: F = None
        self.y: F = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: B = None
        self.p: B = None
        self.s: C = None
        self.q: F = None
        self.txt = txt

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

n = A("n")
e = B("e")
f = C("f")
c = D("c")
l = E("l")
i = F("i")
g = E("g")

n.u = e
n.z = c
n.y = i
e.p = i
e.o = i
e.y = i
e.t = g
e.x = g
f.r = n
f.q = e
c.z = i
l.y = g
l.o = e
l.p = e
l.s = f
l.q = i
i.u = g
i.y = c
g.y = l
g.o = e
g.p = e
g.s = f
g.q = i
assert n.u.p.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: E = None
        self.o: F = None
        self.y: F = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: B = None
        self.p: B = None
        self.s: C = None
        self.q: F = None
        self.txt = txt

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

n = A("n")
e = B("e")
f = C("f")
c = D("c")
l = E("l")
i = F("i")
g = E("g")

n.u = e
n.z = c
n.y = i
e.p = i
e.o = i
e.y = i
e.t = g
e.x = g
f.r = n
f.q = e
c.z = i
l.y = g
l.o = e
l.p = e
l.s = f
l.q = i
i.u = g
i.y = c
g.y = l
g.o = e
g.p = e
g.s = f
g.q = i
assert n.u.p.u.q.txt == "i"