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

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

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

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

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

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

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

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

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

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

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

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

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

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

h.r = d
c.q = h
c.t = j
d.r = c
d.y = n
d.s = m
k.w = j
k.v = d
b.o = h
b.t = h
b.x = j
j.x = d
j.o = n
j.w = h
j.u = c
n.q = h
n.t = j
m.w = j
m.v = d
assert j.w.r.s.w.w.r.s.v.txt == "d"