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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: C = None
        self.u: D = None
        self.p: F = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

c.q = i
c.v = j
j.t = n
j.p = n
g.q = c
g.w = c
b.w = n
b.x = h
n.r = f
h.w = i
h.q = g
h.v = g
h.u = b
h.p = m
h.o = c
f.w = n
f.x = m
m.w = g
m.q = i
m.v = i
m.u = f
m.p = h
m.o = c
k.r = f
i.q = c
i.w = c
assert c.v.p.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: C = None
        self.u: D = None
        self.p: F = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

c.q = i
c.v = j
j.t = n
j.p = n
g.q = c
g.w = c
b.w = n
b.x = h
n.r = f
h.w = i
h.q = g
h.v = g
h.u = b
h.p = m
h.o = c
f.w = n
f.x = m
m.w = g
m.q = i
m.v = i
m.u = f
m.p = h
m.o = c
k.r = f
i.q = c
i.w = c
assert c.v.p.r.x.txt == "m"