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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.s: D = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.s: D = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

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

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