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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: B = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

j = A("j")
f = B("f")
m = C("m")
h = D("h")
k = E("k")
l = F("l")
i = D("i")
d = F("d")
c = F("c")

j.x = i
f.r = j
m.z = j
m.v = f
m.s = i
h.x = l
h.t = l
k.w = i
k.s = d
l.o = j
l.v = j
l.q = f
l.s = m
i.x = d
i.t = l
d.o = j
d.v = j
d.q = f
d.s = m
c.o = j
c.v = j
c.q = f
c.s = m
assert h.x.q.r.x.t.q.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: B = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

j = A("j")
f = B("f")
m = C("m")
h = D("h")
k = E("k")
l = F("l")
i = D("i")
d = F("d")
c = F("c")

j.x = i
f.r = j
m.z = j
m.v = f
m.s = i
h.x = l
h.t = l
k.w = i
k.s = d
l.o = j
l.v = j
l.q = f
l.s = m
i.x = d
i.t = l
d.o = j
d.v = j
d.q = f
d.s = m
c.o = j
c.v = j
c.q = f
c.s = m
assert h.x.q.r.x.t.q.r.x.txt == "i"