class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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