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

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

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

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

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

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

n = A("n")
b = B("b")
m = C("m")
a = D("a")
c = E("c")
k = F("k")

n.o = a
b.p = c
b.w = c
b.y = k
b.v = k
m.z = k
m.w = k
m.y = b
a.q = c
a.p = n
c.t = a
k.t = c
assert n.o.q.t.p.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

n = A("n")
b = B("b")
m = C("m")
a = D("a")
c = E("c")
k = F("k")

n.o = a
b.p = c
b.w = c
b.y = k
b.v = k
m.z = k
m.w = k
m.y = b
a.q = c
a.p = n
c.t = a
k.t = c
assert n.o.q.t.p.o.q.txt == "c"