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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: D = None
        self.o: A = None
        self.q: C = None
        self.t: A = None
        self.r: D = None
        self.txt = txt

f = A("f")
h = B("h")
c = C("c")
l = D("l")
k = E("k")
b = F("b")
m = B("m")

f.q = c
f.v = k
h.w = k
h.r = f
h.s = l
c.p = l
l.x = c
l.r = b
k.s = c
k.w = c
k.r = b
b.z = k
b.u = l
b.r = l
b.o = f
b.t = f
b.q = c
m.w = k
m.r = f
m.s = l
assert h.r.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: D = None
        self.o: A = None
        self.q: C = None
        self.t: A = None
        self.r: D = None
        self.txt = txt

f = A("f")
h = B("h")
c = C("c")
l = D("l")
k = E("k")
b = F("b")
m = B("m")

f.q = c
f.v = k
h.w = k
h.r = f
h.s = l
c.p = l
l.x = c
l.r = b
k.s = c
k.w = c
k.r = b
b.z = k
b.u = l
b.r = l
b.o = f
b.t = f
b.q = c
m.w = k
m.r = f
m.s = l
assert h.r.q.p.txt == "l"