class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: A = None
        self.p: D = None
        self.t: A = None
        self.v: A = None
        self.txt = txt

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

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

b.r = i
d.z = n
d.y = n
d.w = m
d.r = m
n.o = l
g.v = m
g.w = m
g.x = b
g.t = b
l.o = i
l.u = b
l.t = b
l.v = b
l.p = g
i.z = n
i.s = n
i.u = g
i.y = g
m.z = n
m.y = n
m.w = d
m.r = d
assert m.r.r.z.o.p.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: A = None
        self.p: D = None
        self.t: A = None
        self.v: A = None
        self.txt = txt

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

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

b.r = i
d.z = n
d.y = n
d.w = m
d.r = m
n.o = l
g.v = m
g.w = m
g.x = b
g.t = b
l.o = i
l.u = b
l.t = b
l.v = b
l.p = g
i.z = n
i.s = n
i.u = g
i.y = g
m.z = n
m.y = n
m.w = d
m.r = d
assert m.r.r.z.o.p.w.z.txt == "n"