class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.x: A = None
        self.w: F = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.x: A = None
        self.w: F = None
        self.y: A = None
        self.txt = txt

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

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