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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: F = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: F = None
        self.z: B = None
        self.u: B = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
h = C("h")
j = D("j")
m = E("m")
c = F("c")
d = E("d")
a = A("a")

k.o = j
k.z = h
k.w = d
e.z = c
e.o = c
e.w = k
h.t = j
h.w = c
h.z = e
h.u = e
j.q = a
j.x = c
m.o = c
m.r = d
c.v = a
c.r = j
c.o = e
d.o = c
d.r = m
a.o = j
a.z = h
a.w = m
assert d.o.r.x.r.q.w.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: C = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: F = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: F = None
        self.z: B = None
        self.u: B = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
h = C("h")
j = D("j")
m = E("m")
c = F("c")
d = E("d")
a = A("a")

k.o = j
k.z = h
k.w = d
e.z = c
e.o = c
e.w = k
h.t = j
h.w = c
h.z = e
h.u = e
j.q = a
j.x = c
m.o = c
m.r = d
c.v = a
c.r = j
c.o = e
d.o = c
d.r = m
a.o = j
a.z = h
a.w = m
assert d.o.r.x.r.q.w.r.o.txt == "c"