class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: C = None
        self.x: E = None
        self.r: B = None
        self.w: A = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

c.o = b
c.r = b
c.u = d
c.x = h
c.w = i
c.v = m
b.r = m
d.u = c
d.y = m
d.p = i
d.w = n
n.t = m
f.q = i
f.u = m
f.p = m
f.t = d
f.z = h
m.q = b
m.z = n
m.y = h
h.q = c
h.u = m
h.p = m
h.t = d
h.z = f
i.o = b
i.r = b
i.u = d
i.x = h
i.w = c
i.v = m
assert d.p.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: C = None
        self.x: E = None
        self.r: B = None
        self.w: A = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

c.o = b
c.r = b
c.u = d
c.x = h
c.w = i
c.v = m
b.r = m
d.u = c
d.y = m
d.p = i
d.w = n
n.t = m
f.q = i
f.u = m
f.p = m
f.t = d
f.z = h
m.q = b
m.z = n
m.y = h
h.q = c
h.u = m
h.p = m
h.t = d
h.z = f
i.o = b
i.r = b
i.u = d
i.x = h
i.w = c
i.v = m
assert d.p.o.r.txt == "m"