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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.s: D = None
        self.u: F = None
        self.p: B = None
        self.t: D = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
g = C("g")
h = D("h")
k = E("k")
c = F("c")
b = A("b")
a = F("a")
i = B("i")

n.t = g
n.z = b
m.v = h
m.r = i
g.v = m
g.w = n
g.s = h
g.t = h
g.u = a
g.p = i
h.v = k
k.o = b
k.z = a
k.q = a
k.p = c
c.y = i
b.t = g
b.z = n
a.y = i
i.v = h
i.r = m
assert i.r.v.v.p.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.s: D = None
        self.u: F = None
        self.p: B = None
        self.t: D = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
g = C("g")
h = D("h")
k = E("k")
c = F("c")
b = A("b")
a = F("a")
i = B("i")

n.t = g
n.z = b
m.v = h
m.r = i
g.v = m
g.w = n
g.s = h
g.t = h
g.u = a
g.p = i
h.v = k
k.o = b
k.z = a
k.q = a
k.p = c
c.y = i
b.t = g
b.z = n
a.y = i
i.v = h
i.r = m
assert i.r.v.v.p.y.r.txt == "m"