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

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

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

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

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

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

i = A("i")
g = B("g")
l = C("l")
a = D("a")
b = E("b")
k = F("k")
m = C("m")
d = A("d")
j = E("j")

i.r = k
i.v = k
i.t = a
i.o = g
g.y = a
g.r = j
l.w = d
l.t = a
a.r = k
a.q = k
b.z = a
k.r = d
k.x = d
k.z = i
k.w = m
m.w = d
m.t = a
d.r = k
d.v = k
d.t = a
d.o = g
j.z = a
assert m.t.r.x.r.z.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: D = None
        self.v: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

i = A("i")
g = B("g")
l = C("l")
a = D("a")
b = E("b")
k = F("k")
m = C("m")
d = A("d")
j = E("j")

i.r = k
i.v = k
i.t = a
i.o = g
g.y = a
g.r = j
l.w = d
l.t = a
a.r = k
a.q = k
b.z = a
k.r = d
k.x = d
k.z = i
k.w = m
m.w = d
m.t = a
d.r = k
d.v = k
d.t = a
d.o = g
j.z = a
assert m.t.r.x.r.z.t.q.txt == "k"