class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.y: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: D = None
        self.y: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.y: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: D = None
        self.y: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

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

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