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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: E = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: B = None
        self.r: C = None
        self.q: E = None
        self.txt = txt

k = A("k")
i = B("i")
h = C("h")
j = D("j")
d = E("d")
b = F("b")
g = C("g")
a = C("a")
c = E("c")
f = F("f")

k.w = f
k.q = i
k.s = a
k.x = h
k.r = g
i.z = j
i.q = k
i.o = c
h.s = i
j.v = k
j.y = c
j.s = g
j.r = h
d.r = c
b.s = j
b.v = i
b.r = g
b.q = d
g.s = i
a.s = i
c.r = d
f.s = j
f.v = i
f.r = g
f.q = c
assert d.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.q: B = None
        self.s: C = None
        self.x: C = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: E = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: B = None
        self.r: C = None
        self.q: E = None
        self.txt = txt

k = A("k")
i = B("i")
h = C("h")
j = D("j")
d = E("d")
b = F("b")
g = C("g")
a = C("a")
c = E("c")
f = F("f")

k.w = f
k.q = i
k.s = a
k.x = h
k.r = g
i.z = j
i.q = k
i.o = c
h.s = i
j.v = k
j.y = c
j.s = g
j.r = h
d.r = c
b.s = j
b.v = i
b.r = g
b.q = d
g.s = i
a.s = i
c.r = d
f.s = j
f.v = i
f.r = g
f.q = c
assert d.r.r.r.r.txt == "d"